<template>
	<view>
		<view class="cu-list menu sm-border card-menu margin-top" >
			<view class="cu-item arrow" v-for="(item, index) in helpList" :key="index" @click="gotoDetail(item.id)">
				<view class="content">
					<text class="text-grey">{{item.helpTitle}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	
	import { helpCategory, helpList } from '@/api/cms.js'
	
	export default {
		data() {
			return {
				categoryId: 0,
				category: {},
				helpList: [],
			}
		},
		onLoad(options) {
			this.categoryId = options.categoryId
		},
		onShow() {
			this.getHelpCategory();
			this.getHelpList();
		},
		methods: {
			getHelpCategory() {
				helpCategory({
					categoryId: this.categoryId
				}).then(res => {
					this.category = res.data;
					uni.setNavigationBarTitle({
						title: this.category.name
					})
				})
			},
			
			getHelpList() {
				helpList({
					categoryId: this.categoryId
				}).then(res => {
					this.helpList = res.data;
				})
			},
			
			gotoDetail(id) {
				uni.$u.route({
					url: 'pages/news/helpDetail',
					params: {
						id: id,
					}
				})
			}
			
		}
	}
</script>

<style>

</style>
